<link rel="stylesheet" type="text/css" href="${path}/skin/css/jquery.datetimepicker.css"/ >
<script src="${path}/skin/lib/jquery/jquery.datetimepicker.min.js"></script>
<script src="${path}/skin/build/jquery.datetimepicker.full.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	$.datetimepicker.setLocale('ch');//设置中文
	$('#datetimepicker_format').datetimepicker({value: "",
		format: $("#datetimepicker_format_value").val()});
	
	$("#editorBut").on("click",function(){
		var id = $("input[name='id']").val();
		var userName = $("input[name='name']").val();
		var password = $("input[name='password']").val();
		var sex = $('input:radio[name="sex"]:checked').val();
		var status = $('input:radio[name="status"]:checked').val();
		var realName = $("input[name='realName']").val();
		var phone = $("input[name='phone']").val();
		var companyId = $("#companyId").find("option:selected").val();
		var level = $("input[name='level']").val();
		var address = $("input[name='address']").val();
		var email = $("input[name='email']").val();
		var joinTime = $("#datetimepicker_format").val();
		var IDcard = $("input[name='IDcard']").val();
		var major = $("input[name='major']").val();
		
		var role = "";
		var groupCheckbox=$("input[name='check']");
	    for(i=0;i<groupCheckbox.length;i++){
	        if(groupCheckbox[i].checked){
	        	role =role+ groupCheckbox[i].value+ ',';
	        }
	    }
		
		$.post("${path}/user/editorUser",{
			id:id,
			userName:userName,
			password:password,
			realName:realName,
			sex:sex,
			status:status,
			phone:phone,
			level:level,
			companyId:companyId,
			address:address,
			email:email,
			joinTime:joinTime,
			IDcard:IDcard,
			major:major,
			
			role:role
		},function(data,status){
			if(data.success){
				window.location.href="${path}/user/list";
			}
		})
	});
})
</script>
<div>
	<input type="hidden" name="id" value="${map.userInfo.ID}">
	登录名：<input name="name" value="${map.userInfo.USER_NAME}"><br/>
	密码：     <input name="password" value="${map.userInfo.PASSWORD}"><br/>
	选择角色：
	#foreach ($role in $map.userInfo.role)
			<input type="checkbox" name="check" ${role.checked} value="${role.ID}" />${role.NAME}
	#end 
	<br/>
	单位名称：
	<select id="companyId" name="">
	     <option value=" " >请选择</option>
	     #foreach ($company in $map.compant)
	        <option value="${company.id}" #if($map.userInfo.COMPANYID == $company.id) selected="selected" #end > ${company.name}</option>
		  #end 
	</select><br/>
	姓名：
	#if($map.userInfo.REAL_NAME)
		<input name="realName" value="${map.userInfo.REAL_NAME}">
	#else
		<input name="realName" value="">
	#end<br/>
	身份证号：
	#if($map.userInfo.IDCARD)
		<input name="IDcard" value="${map.userInfo.IDCARD}">
	#else
		<input name="IDcard" value="">
	#end<br/>
	性别：<input id="x1" type="radio" value="0" name="sex" #if($map.userInfo.SEX == 0) checked #end/>男
		  <input id="x2" type="radio" value="1" name="sex" #if($map.userInfo.SEX == 1) checked #end/>女  <br/>
	电话：
	#if($map.userInfo.PHONE)
		<input name="phone" value="${map.userInfo.PHONE}">
	#else
		<input name="phone" value="">
	#end<br/>
	级别: 
	#if($map.userInfo.LEVEL)
		<input name="level" value="${map.userInfo.LEVEL}">
	#else
		<input name="level" value="">
	#end<br/>
	住址：
	#if($map.userInfo.ADDRESS)
		<input name="address" value="${map.userInfo.ADDRESS}">
	#else
		<input name="address" value="">
	#end<br/>
	专业：
	#if($map.userInfo.MAJOR)
		<input name="major" value="${map.userInfo.MAJOR}">
	#else
		<input name="major" value="">
	#end<br/>
	邮箱：
	#if($map.userInfo.EMAIL)
		<input name="email" value="${map.userInfo.EMAIL}">
	#else
		<input name="email" value="">
	#end<br/>
	加入时间:
	#if($map.userInfo.JOIN_TIME)
		<input type="text" id="datetimepicker_format" class="input input-wide" value="${map.userInfo.JOIN_TIME}"/>
	#else
		<input type="text" id="datetimepicker_format" class="input input-wide"/>
	#end<br/>
	 <br/>
	状态：<input id="z1" type="radio" value="0" name="status" #if($map.userInfo.STATUS == 0) checked #end/>正常启用
		 <input id="z2" type="radio" value="1" name="status" #if($map.userInfo.STATUS == 1) checked #end/>异常  <br/>
	<button type='button' id="editorBut">修改</button>
</div>